--
-- Author: gnar
-- Date: 2015-12-31 23:23:22
--
local CreateSceneCCB = class("CreateSceneCCB", cc.load("mvc").ViewBase)


function CreateSceneCCB:ctor()
    CreateSceneCCB.super.ctor(self)
end

function CreateSceneCCB:onCreate()
   
    self.luafilePath = "views.CreateSceneCCB"
    self:getCcbNode():addTo(self)
    
    self.setControlButtonTitle(self.controlButton, Word(0).CreateSceneCCB_01)

end

function CreateSceneCCB:onEnter_()
    ManagerNotification:registerObserver("user.creteCharacter",self,_onCreteCharacter )
end

function CreateSceneCCB:onExit_()
	  CreateSceneCCB.super.onExit_()
    ManagerNotification:unregisterObserver("user.creteCharacter",self)
end

function CreateSceneCCB.call(sender,controlEvent,self)
	   _creteCharacter()
end


_onCreteCharacter = function(characterList)
   
    MyApp:enterScene("ChooseSceneCCB", {showId = #ManagerUserData.userData.characterDataForChoose})
   
end

_creteCharacter = function()

	math.randomseed(os.time())
	local characterInfo = {name = "name" .. math.random(1,1000),job = math.random(1,3), modelId = math.random(1,5),level = 1}
    AdapterSendMsg:sendMsg("user.creteCharacter",{characterInfo = characterInfo})
end




return CreateSceneCCB